package com.runjian.rundo.iot.agent.iec104.parser.frame;

import lombok.Getter;
import lombok.Setter;

/**
 * 双点遥控信息
 *
 * @author CaoQingHua
 */
@Getter
@Setter
public abstract class PointRemoteControl implements Frame {

    private boolean type;

    private int status;

    public PointRemoteControl(boolean type, int status) {
        this.type = type;
        this.status = status;
    }

    @Override
    public String toString() {
        return this.console();
    }

    public String getHexStr() {
        return getHexStr(type, status);
    }

    public String getHexStr(boolean type, int status) {
        if (type) {
            return String.format("%02X", 128 + status);
        }
        return String.format("%02X", status);
    }

    public abstract String getStatusStr();

}
